package com.flyqiu.form.model;

import com.flyqiu.form.common.col.SqlColType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
public class DefaultSqlColType implements SqlColType {
    @Schema(title = "sql列类型")
    protected String sqlDataType;

    @Schema(title = "数据长度", description = "sqlDataType数据长度")
    protected Integer sqlDataLength;
    
    @Schema(title = "数值刻度：即小数位数", description = "当数据类型为数字类型时有效，数值刻度：即小数位数")
    protected Integer precision;

    public void setSqlDataType(String sqlDataType) {
        if (StringUtils.isAllBlank(sqlDataType)) {
            this.sqlDataType = sqlDataType;
            return;
        }
        sqlDataType = sqlDataType.replaceAll("\r\n|\r|\n", "");
        this.sqlDataType = sqlDataType;
    }


}
